home *** CD-ROM | disk | FTP | other *** search
/ C++ für Kids / C++ for kids.iso / Buch / Rund1.cpp < prev    next >
C/C++ Source or Header  |  1998-12-27  |  1KB  |  47 lines

  1. //---------------------------------------------------------------------------
  2. #include <vcl\vcl.h>
  3. #pragma hdrstop
  4.  
  5. #include "Rund1.h"
  6. //---------------------------------------------------------------------------
  7. #pragma resource "*.dfm"
  8.  
  9. int x, y, Dicke;
  10. TForm1 *Form1;
  11. //---------------------------------------------------------------------------
  12. __fastcall TForm1::TForm1(TComponent* Owner)
  13.     : TForm(Owner)
  14. {
  15. }
  16. //---------------------------------------------------------------------------
  17. void __fastcall TForm1::Button1Click(TObject *Sender)
  18. {
  19.   Canvas->Ellipse (x, y, x+Dicke, y+Dicke);
  20. }
  21. //---------------------------------------------------------------------------
  22. void __fastcall TForm1::Button2Click(TObject *Sender)
  23. {
  24.   TRect Quelle, Ziel;
  25.   for (int i=x-5; i<ClientWidth-Dicke-x-5; i++)
  26.   {
  27.     Quelle = Rect(i,   y-5, i+Dicke+5, y+Dicke+5);
  28.     Ziel   = Rect(i+1, y-5, i+Dicke+6, y+Dicke+5);
  29.     Canvas->CopyRect(Ziel, Canvas, Quelle);
  30.     // Bremse, abhΣngig vom Prozessortakt!
  31.     for (int j=0; j<1000000; j++) ;
  32.   }
  33. }
  34. //---------------------------------------------------------------------------
  35. void __fastcall TForm1::Button3Click(TObject *Sender)
  36. {
  37.   Refresh ();
  38. }
  39. //---------------------------------------------------------------------------
  40. void __fastcall TForm1::FormCreate(TObject *Sender)
  41. {
  42.   x = 30;
  43.   y = 30;
  44.   Dicke = 150;
  45. }
  46. //---------------------------------------------------------------------------
  47.